test(query-devtools/contexts/ThemeContext): split 'ThemeContext' tests into a unit test file mirroring the 'src/contexts' structure#10787
Conversation
…s into a unit test file mirroring the 'src/contexts' structure
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTheme context tests previously embedded in ChangesTheme Context Test Organization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit fa3f9ab
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 24 bumped as dependents. 🟩 Patch bumps
|
size-limit report 📦
|
🎯 Changes
Move the
ThemeContextmodule-level case added in #10786 out ofDevtools.test.tsxinto a dedicatedsrc/__tests__/contexts/ThemeContext.test.tsx, mirroring thesrc/contextsdirectory layout. The settings-menu Theme UI cases stay inDevtools.test.tsxbecause they exercise theDevtoolsdropdown menu andlocalStoragepersistence, not theThemeContextmodule itself.Drop the
QueryDevtoolsContext+PiPProvider+Devtoolsmount boilerplate and replace it with a smallrenderThemeProbehelper that mounts only aThemeProbeconsumer.The new file covers the three behaviors that make up the
ThemeContextmodule's contract:default value: resolves to'dark'when noThemeContext.Providerwraps the consumer.with a "ThemeContext.Provider"→ value resolution: resolves to the value provided by theProvider('light'/'dark').with a "ThemeContext.Provider"→ reactiveAccessor: reflects updates when theProvidervalue is a reactiveAccessor, which is the production pattern that motivatescreateContext<Accessor<…>>.A local
type Theme = ReturnType<ReturnType<typeof useTheme>>keeps every'light' | 'dark'literal in sync with theThemeContextdefinition.Coverage:
src/contexts/ThemeContext.ts: 100% (Stmts / Branch / Funcs / Lines) from this file alone.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit